package com.chandra.pos.product.repository;

import com.chandra.pos.product.dao.entity.Product;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Customer: T4671
 * Date: 10/1/13
 * Time: 4:34 PM
 * To change this template use File | Settings | File Templates.
 *
 * http://spring.io/blog/2011/02/10/getting-started-with-spring-data-jpa/
 */

@Transactional(readOnly = true)
public interface ProductRepository extends JpaRepository<Product, Long>,ProductRepositoryCustom{


    @Query("select u from Product u where lower(u.name) like ?1")
    public List<Product> findByNameLike(String name);


    @Query("select u from Product u where lower(u.name) = ?1")
    public Product findByName(String lastName);



}
